    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>屏幕宽度改变时改变颜色</title>
    </head>
    <script src="jQuery1.0.0.1.js"></script>
    <body>
    <script>
        //检测浏览器宽度与检测屏幕宽度所用函数不同
        // window.onresize = function () {
        //     document.title = client().width + "    "+ client().height;
        // }
        // window.onresize = function () {
        //     document.title = window.screen.width + "    "+ window.screen.height;
        // }
        window.onresize=col1;
        col1();
        function col1 () {
            if (window.screen.width>1960){
                document.body.style.background='#41cc19';
            }else if (window.screen.width>650){
                document.body.style.background='#2b0ccc';
            }else{
                document.body.style.background='#cc141a';
            }
        }
    </script>
    </body>
    </html>